package com.itWaiLong.Controller.Comment;

import com.itWaiLong.Dao.Comment;
import com.itWaiLong.Result.Result;
import com.itWaiLong.Service.CommentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/comment")
public class AddCommentController {

    @Autowired
    private CommentService commentService;

    /**
     * 添加评论
     * @param comment
     * @return
     */
    @PostMapping("/addComment")
    public Result addComment(@RequestBody Comment comment) {
        log.info("评论信息：{}", comment);
        commentService.add(comment);
        return Result.success();
    }
}
